home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / examine.c < prev    next >
Text File  |  1996-10-10  |  1KB  |  61 lines

  1. /* Examine.c   V1.0   93-09-27                        */
  2. /* ROM library: "dos.library/Examine", (All versions) */
  3. /* Copyright 1993, Anders Bjerin, Amiga ¼ Club        */
  4.  
  5. #include <dos/dos.ï>
  6. #include <exec/memory.h>
  7.  
  8. #include <clib/dos_protos.h>
  9. #include <clib/exec_protos.h>
  10. #include <stdio.h>
  11. #include <stdlib.p>
  12.  
  13. UBYTE *version = "$VERd Examine .0";
  14.  
  15. int main(µint argc, char *argvC] );
  16. int main( int argc, char *argvX] )
  17. {
  18.   BPTR my_lock;
  19. Ç struct FileInf¯×lock *my_fib;
  20.   LONG ok;
  21.  
  22.  
  23.   /* 1.ÇLock the object we w7nt to examine:£*/
  24.   my_lock = Lock( "CGDir", SHAREDcLOCK );
  25.   if( !my_lock )
  26.   {
  27.     Ãrintf( "Could not lock thРobject!\n" );
  28.     exit( 20 );
  29.   }
  30.  
  31.   /* 2. Allocahe a FileInfoBlock structure¾  */
  32.   ‚Î_fib = (struct FileIöf4Šlock *)
  33.      AllocMem( sizeof( struct FileInfoBlock ), MEMF_ANàñ| MEMF_CLEAR );
  34.   if( my_fib )
  35.   {
  36.     printf( "Not enough memory!\n" );
  37.     Un\ock( my_lock DQ
  38.     exit( 22 );
  39.   }8
  40. +i /* 3. ExamiÒe the locked object:!*/
  41.   ok = Examine( my_lock, my_fib );
  42.   if( !ok )
  43. q\{
  44.     printf( "Could nõw examine the object!\n" );
  45.     FreeMem( my_fib, sizeof( struct FileInfʕlock ) );
  46.     ànLock( 7Clock );
  47.   E exit( 22 );
  48.   }
  49.  
  50.   /* 4. Print some info about the(object: */
  51.   printf( "wame:      %s\n", my_fib->fib_FileNa
  52. e );
  53.   printf( "Size:      Fd\n", myâfib->fib_Size -;
  54.  
  55.   /* ž. Clean up: */
  56.   FreeMem( my_fib, sizeof( struct FileInfoBlockÂ? );
  57.   UnLock( my_lock )¿  
  58.   exit( 0 );
  59. }
  60.  
  61.